<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="wzc">
        <h2>绑定监听</h2>
        <button @click='test1'>test1</button>
        <button @click="test2('wzc')">test2</button>
        <button @click="test3">test3</button>
        <button @click="test4(123,$event)">test4</button>
        <h2>事件修饰符</h2>
        <div style="width: 200px;height: 200px;background-color: red;" @click='test5'>
            <!-- 停止事件冒泡 -->
            <div style="width: 100px;height: 100px;background-color: blue;" @click.stop='test6'></div>
        </div>
        <!-- 阻止事件的默认行为 -->
        <a href="http://www.baidu.com" @click.stop="test7">去百度</a>
        <h2>按键修饰符</h2>
        <input type="text" @keyup.enter="test9">
        <input type="text" @keyup.13="test9">
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: "#wzc",
            data: {
                test1() {
                    console.log('test1');
                },
                test2(msg) {
                    console.log(msg);
                },
                test3(event) {
                    console.log(event.target.innerHTML)
                },
                test4(number, event) {
                    console.log(number + `---` + event.target.innerHTML)
                },
                test5() {
                    console.log("test5")
                },
                test6() {
                    console.log("test6")
                },
                test7() {
                    console.log('c')
                },
                test8() {
                    console.log()
                },
                test9() {
                    console.log(event.target.value)
                }


            }
        })
    </script>
</body>

</html>